| 
                
               | 
              
                
               | 
              
                @@ -40,16 +40,17 @@ class Command(CompatibilityBaseCommand): 
               | 
            
            
            
              | 
                40
               | 
              
                40
               | 
              
                             for m in models: 
               | 
            
            
            
              | 
                41
               | 
              
                41
               | 
              
                                 logs = SaleclerkSubmitLogInfo.objects.filter(model_pk=m.pk, dupload=False, test_sn=False, ym__gte=lastmonth, status=True) 
               | 
            
            
            
              | 
                42
               | 
              
                42
               | 
              
                                 for d in distributors: 
               | 
            
            
            
              | 
                43
               | 
              
                
               | 
              
                -                    saleclerks = SaleclerkInfo.objects.filter(brand_id=b.brand_id, distributor_id=d.distributor_id, status=True) 
               | 
            
            
            
              | 
                44
               | 
              
                43
               | 
              
                                     yesterday_num = 0 
               | 
            
            
            
              | 
                45
               | 
              
                44
               | 
              
                                     current_month = 0 
               | 
            
            
            
              | 
                46
               | 
              
                45
               | 
              
                                     last_month = 0 
               | 
            
            
            
              | 
                47
               | 
              
                
               | 
              
                -                    for saleclerk in saleclerks: 
               | 
            
            
            
              | 
                48
               | 
              
                
               | 
              
                -                        print saleclerk.clerk_id 
               | 
            
            
            
              | 
                49
               | 
              
                
               | 
              
                -                        log = logs.filter(clerk_id=saleclerk.clerk_id) 
               | 
            
            
            
              | 
                50
               | 
              
                
               | 
              
                -                        yesterday_num += logs.filter(ymd=lastday).count() 
               | 
            
            
            
              | 
                51
               | 
              
                
               | 
              
                -                        current_month += logs.filter(ym=month).count() 
               | 
            
            
            
              | 
                52
               | 
              
                
               | 
              
                -                        last_month += logs.filter(ym=lastmonth).count() 
               | 
            
            
            
              | 
                
               | 
              
                46
               | 
              
                +                    if logs.count() != 0: 
               | 
            
            
            
              | 
                
               | 
              
                47
               | 
              
                +                        saleclerks = SaleclerkInfo.objects.filter(brand_id=b.brand_id, distributor_id=d.distributor_id, status=True) 
               | 
            
            
            
              | 
                
               | 
              
                48
               | 
              
                +                        for saleclerk in saleclerks: 
               | 
            
            
            
              | 
                
               | 
              
                49
               | 
              
                +                            print saleclerk.clerk_id 
               | 
            
            
            
              | 
                
               | 
              
                50
               | 
              
                +                            log = logs.filter(clerk_id=saleclerk.clerk_id) 
               | 
            
            
            
              | 
                
               | 
              
                51
               | 
              
                +                            yesterday_num += logs.filter(ymd=lastday).count() 
               | 
            
            
            
              | 
                
               | 
              
                52
               | 
              
                +                            current_month += logs.filter(ym=month).count() 
               | 
            
            
            
              | 
                
               | 
              
                53
               | 
              
                +                            last_month += logs.filter(ym=lastmonth).count() 
               | 
            
            
            
              | 
                53
               | 
              
                54
               | 
              
                  
               | 
            
            
            
              | 
                54
               | 
              
                55
               | 
              
                                     if m.is_important or (yesterday_num or current_month or last_month): 
               | 
            
            
            
              | 
                55
               | 
              
                56
               | 
              
                                         SalesResponsibilityInfoModelsSaleStatisticInfo.objects.create( 
               |